import 'package:flutter/material.dart';

import '../../config/Config.dart';
import '../../util/CommonUtils.dart';

class MessageItem extends StatelessWidget {
  final String content;
  final int type;

  const MessageItem({super.key, required this.content, required this.type});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.only(top: 8),
      child: type == 0
          ? Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                CommonUtils.getImageAsset("tone_ethereal", width: 32),
                const SizedBox(
                  width: 8,
                ),
                Expanded(
                  child: Container(
                    padding: const EdgeInsets.all(8),
                    decoration: BoxDecoration(
                      color: Config.colorEdf3ff,
                      borderRadius: BorderRadius.circular(4),
                    ),
                    child: GestureDetector(
                      child: Text(
                        content,
                        style: TextStyle(
                          color: Config.color3c3d42,
                          fontSize: 15,
                        ),
                      ),
                    ),
                  ),
                ),
                const SizedBox(
                  width: 16,
                )
              ],
            )
          : Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                const SizedBox(
                  width: 16,
                ),
                Expanded(
                  child: Container(
                    padding: const EdgeInsets.all(8),
                    decoration: BoxDecoration(
                      color: Config.color597cfe,
                      borderRadius: BorderRadius.circular(4),
                    ),
                    child: Text(
                      content,
                      style: const TextStyle(
                        color: Colors.white,
                        fontSize: 15,
                      ),
                    ),
                  ),
                ),
                const SizedBox(
                  width: 8,
                ),
                CommonUtils.getImageAsset("tone_ethereal", width: 32),
              ],
            ),
    );
  }
}
